using MediatR;

namespace TerritoryGame.Application.Queries;

public record GetGameStatsQuery : IRequest<GetGameStatsResult>
{
    public Guid GameId { get; init; }
}

public record GetGameStatsResult
{
    public bool Success { get; init; }
    public string? ErrorMessage { get; init; }
    public GameStatsInfo? GameStats { get; init; }
}

public record GameStatsInfo
{
    public Guid GameId { get; init; }
    public string RoomName { get; init; } = string.Empty;
    public DateTime CreatedAt { get; init; }
    public DateTime? StartTime { get; init; }
    public DateTime? EndTime { get; init; }
    public int Duration { get; init; } // 实际游戏时长（秒）
    public int TotalPixels { get; init; }
    public List<PlayerStatsInfo> PlayerStats { get; init; } = new();
    public PlayerStatsInfo? Winner { get; init; }
}

public record PlayerStatsInfo
{
    public Guid Id { get; init; }
    public string NickName { get; init; } = string.Empty;
    public string Color { get; init; } = string.Empty;
    public int TotalPixels { get; init; }
    public int PaintActions { get; init; }
    public double AverageBrushSize { get; init; }
    public TimeSpan ActiveTime { get; init; }
    public int Rank { get; init; }
}
